<template>
  <view>
  <view class="top_container">
    <navigator url="../../subpkg/search/search"><uni-icons type="search" size="36rpx" color="#0276F4"></uni-icons></navigator>
    <view class="text_con">
      <view class="dingyue" @click="ChangeFlag(0)":style="{fontSize:!flag? 50+'rpx' : 40+'rpx',fontWeight:!flag? 'bold' : ' '}">
        订阅
      </view>
      <view class="tuijian" @click="ChangeFlag(1)" :style="{fontSize:flag? 50+'rpx' : 40+'rpx',fontWeight:flag? 'bold' : ' '}">
        推荐
      </view>
    </view>
  </view>
  <my_subscribe v-if="!flag"  ></my_subscribe>
  <my_recommend v-if="flag" ></my_recommend>
  <uni-popup ref="alertDialog2" type="dialog">
  				<uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="立即登录" title="抱歉" content="您尚未登录" @confirm="gotolog()"
  					@close="dialogClose"></uni-popup-dialog>
  			</uni-popup>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        flag:1,
        is_log:false,
      };
    },
    onShow(){
      this.is_log = JSON.parse(uni.getStorageSync('is_log') || false);
    },
    methods: {
      gotolog(){
        uni.switchTab({
          url:'./../My/My'
        })
      },
     ChangeFlag(num){
       if(num==1){
         this.flag=1;
       }else{
         if(this.is_log){
           this.flag=0;
         }else{
           this.$refs.alertDialog2.open()
         }
     }
    }
  },
  }
</script>

<style lang="scss">
.top_container{
  display: flex;
  justify-content: flex-start;
  align-items: center;
  height: 53px;
  .uni-icons{
    margin-left: 36rpx;
  }
  .text_con{
    display: flex;
    margin-left:166rpx;
    justify-content: space-around;
    font-size: 40rpx;
    color: #0276F4;
    height: 100%;
    align-items: center;
    width: 300rpx;
    .tuijian{
      transition: all .3s;
    }
    .dingyue{
      transition: all .3s;
    }
  }
}
</style>
